package com.bweab.controll.userstbcontrol;

import com.bweab.pojo.UsersTb;
import com.bweab.service.api.UsersTbServiceInterface;
import com.bweab.service.impl.UsersTbServiceInterfaceImpl;
import com.bweab.util.JSONResult;
import com.bweab.util.WebUtil;
import jakarta.servlet.ServletException;
import jakarta.servlet.annotation.WebServlet;
import jakarta.servlet.http.HttpServlet;
import jakarta.servlet.http.HttpServletRequest;
import jakarta.servlet.http.HttpServletResponse;

import java.io.IOException;

@WebServlet("/adminQueryUserInfo")
public class AdminQueryUserInfo extends HttpServlet {

    //创建服务
    UsersTbServiceInterface  usersTbService =new UsersTbServiceInterfaceImpl();
    @Override
    protected void service(HttpServletRequest req, HttpServletResponse resp) throws ServletException, IOException {
        //获取用户信息
        String username = req.getParameter("username");
        //调用服务查询
        JSONResult jsonResult= usersTbService.AdminQueryUserInfoByName(username);
        //发送数据
        WebUtil.writeJson(resp,jsonResult);

    }
}
